#pragma once

#include <iostream>
#include <fstream>

using namespace std;

enum ErrorType {
	System = 1,
	Lexical,
	Syntax,
	Semantics,
	Warning
};

struct ErrorElement {
	ErrorType errorType;
	int strinNumber;
	string description;
};

class ErrorContainer
{
public:
	static ErrorContainer* get_instance(); // method to get object
	void addError(ErrorElement err);
	void addError(ErrorType errType, int errString, string errDescription);
	void addError(ErrorType errType, string errDescription);
	vector<ErrorElement> getErrors();
	int getErrorsNum();
	int getWarningsNum();
	void printToCons();
	void printToFile(string filePath);
	void setFlags(bool failOnWarining);
	bool check();
private:
	ErrorContainer(void);
	~ErrorContainer(void);

	// object that is created only once
	static ErrorContainer *errorContainer;

	vector<ErrorElement> errors;
	int errorsNum;
	int warningsNum;
	bool failOnWarining;
};
